Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use rapids-logger to generate the cudf logger #17307

Merged
merged 13 commits into from
Dec 10, 2024

Conversation

vyasr
Copy link
Contributor

@vyasr vyasr commented Nov 13, 2024

Description

This PR replaces cudf's logger implementation with one generated using https://github.com/rapidsai/rapids-logger. This approach allows us to centralize the logger definition across different RAPIDS projects while allowing each project to vendor its own copy with a suitable set of macros and default logger objects. The common logger also takes care of handling the more complex packaging problems around ensuring that we fully isolate our spdlog dependency and do not leak any of its symbols, allowing our libraries to be safely installed in a much broader set of environments.

Contributes to rapidsai/build-planning#104.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@vyasr vyasr added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Nov 13, 2024
@vyasr vyasr self-assigned this Nov 13, 2024
@github-actions github-actions bot added libcudf Affects libcudf (C++/CUDA) code. CMake CMake build issue labels Nov 13, 2024
@github-actions github-actions bot added Python Affects Python cuDF API. Java Affects Java cuDF API. cudf.pandas Issues specific to cudf.pandas cudf.polars Issues specific to cudf.polars pylibcudf Issues specific to the pylibcudf package labels Nov 18, 2024
@vyasr vyasr changed the base branch from branch-24.12 to branch-25.02 November 18, 2024 19:57
Copy link

copy-pr-bot bot commented Dec 2, 2024

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions github-actions bot removed Python Affects Python cuDF API. Java Affects Java cuDF API. cudf.pandas Issues specific to cudf.pandas cudf.polars Issues specific to cudf.polars pylibcudf Issues specific to the pylibcudf package labels Dec 2, 2024
@vyasr
Copy link
Contributor Author

vyasr commented Dec 3, 2024

/ok to test

@vyasr
Copy link
Contributor Author

vyasr commented Dec 3, 2024

/ok to test

@vyasr vyasr requested review from a team as code owners December 3, 2024 20:31
@vyasr vyasr changed the title Use the new logger generator in rmm Use rapids-logger to generate the cudf logger Dec 3, 2024
Copy link
Contributor

@karthikeyann karthikeyann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is cudf/logger.hpp ?

@vyasr
Copy link
Contributor Author

vyasr commented Dec 3, 2024

It's defined in https://github.com/rapidsai/rapids-logger, specifically https://github.com/rapidsai/rapids-logger/blob/main/logger.hpp.in. We effectively have the same logger code copied into various RAPIDS libs (e.g. cuml has it too) so the idea is that we use CMake to generate project-specific loggers from a template.

cpp/CMakeLists.txt Outdated Show resolved Hide resolved

#include <dlfcn.h>
#include <sys/stat.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this for functions like fstat that we were previously getting via transitive includes from spdlog.

Comment on lines 918 to 919
# Define logging level
target_compile_definitions(cudf PRIVATE "CUDF_LOG_ACTIVE_LEVEL=LIBCUDF_LOGGING_LEVEL")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused as these are two separate env variables but seem to define the same thing? Can we combine them so we only have one env var for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LIBCUDF_LOGGING_LEVEL is a CMake variable, while CUDF_LOG_ACTIVE_LEVEL is a preprocessor definition (#define in C/C++). They are independent entities that both need to exist since they serve different purposes. If you prefer, I can align the CMake variable's name with the underlying define, but that would be a breaking change for the build.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realize that LIBCUDF_LOGGING_LEVEL is CMake variable but there is an env variable with the same name. So technically we have at least 3 logging variables. Probably my previous request to combine all of them into one is impossible. Maybe rename them to be something else better to understand? For example, can be like CUDF_COMPILE_LOG_LEVEL (so we know it is used for compiling C++ code), and CUDF_ENV_LOG_LEVEL so we know it is environment variable used at runtime etc.

@vyasr vyasr requested review from ttnghia and karthikeyann December 4, 2024 23:01
Copy link
Contributor

@ttnghia ttnghia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My minor concern is I would like to have CUDF_LOG_ACTIVE_LEVEL and LIBCUDF_LOGGING_LEVEL combined into just one variable so we don't have to maintain both. This can be a future work. Otherwise this is great.

@vyasr
Copy link
Contributor Author

vyasr commented Dec 4, 2024

My minor concern is I would like to have CUDF_LOG_ACTIVE_LEVEL and LIBCUDF_LOGGING_LEVEL combined into just one variable so we don't have to maintain both. This can be a future work. Otherwise this is great.

I tried to explain why they are different in the thread, but please let me know if that explanation isn't clear. They are fundamentally different types of variables.

Copy link
Member

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved! With a question about follow-up work.

cpp/cmake/thirdparty/get_spdlog.cmake Show resolved Hide resolved
@vyasr
Copy link
Contributor Author

vyasr commented Dec 10, 2024

/merge

@rapids-bot rapids-bot bot merged commit 5306eca into rapidsai:branch-25.02 Dec 10, 2024
115 of 124 checks passed
@vyasr vyasr deleted the feat/logger branch December 10, 2024 18:02
AyodeAwe pushed a commit that referenced this pull request Dec 11, 2024
## Description
#17307 broke builds that use the rapids-cmake pinned dependencies
feature since no version was specified for the rapids_logger dependency.
This adds a version string equal to the git tag so the dependency has a
stated version.

## Checklist
- [X] I am familiar with the [Contributing
Guidelines](https://github.com/rapidsai/cudf/blob/HEAD/CONTRIBUTING.md).
- [ ] New or existing tests cover these changes.
- [X] The documentation is up to date with these changes.

---------

Co-authored-by: Nghia Truong <[email protected]>
Co-authored-by: Vyas Ramasubramani <[email protected]>
Co-authored-by: Bradley Dice <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake CMake build issue improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants